package com.bawei.rk_01.Home

import androidx.lifecycle.viewModelScope
import com.bawei.base.utils.SingLiveData
import com.bawei.base.utils.bean.LqCouponsEntity
import com.bawei.base.utils.bean.Res
import com.bawei.base.utils.mvvm.BaseViewModel
import kotlinx.coroutines.launch
import retrofit2.http.Query

class LqCouponsViewModel : BaseViewModel() {

    val lqsuccess = SingLiveData<Res<LqCouponsEntity>>()
    val lqfail = SingLiveData<String>()
    fun lqcoupons(limit:String, page:String, type:String){
        viewModelScope.launch {
            try {
                lqsuccess.postValue(apiService.viewcoupons(limit, page, type))
            }catch (e:Exception){
                lqfail.postValue(e.message.toString())
            }
        }
    }

}